﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;

namespace Freedback.Core.Context
{
    public static class QueryableExtensions
    {
        internal static IIncluder Includer = new NothingIncluder();

        /// <summary>
        /// *** EXTENSION METHOD *** Includes entities related to the "source" expressed via the "path"
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="TProperty"></typeparam>
        /// <param name="source"></param>
        /// <param name="path"></param>
        /// <returns></returns>
        public static IQueryable<T> Include<T, TProperty>(this IQueryable<T> source, Expression<Func<T, TProperty>> path) where T : class
        {
            return Includer.Include(source, path);
        }
    }
}
